package com.mall4j.cloud.base.exception;


/**
 * 全局业务异常基类
 *
 * @author lihuan
 */
public class BaseException extends RuntimeException {

    private IErrorCode errorCode;

    public BaseException() {
    }

    public BaseException(IErrorCode errorCode) {
        this.errorCode = errorCode;
    }

    public IErrorCode getErrorCode() {
        return errorCode;
    }

    public BaseException(String message) {
        super(message);
    }

    public BaseException(String code, String message) {
        this.errorCode = new IErrorCode() {
            @Override
            public String getCode() {
                return code;
            }

            @Override
            public String getInfo() {
                return message;
            }
        };
    }

    public BaseException(Throwable cause) {
        super(cause);
    }

    public BaseException(String message, Throwable cause) {
        super(message, cause);
    }

    public BaseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
}
